package Strategy;

import java.util.Random;

/**
 * <p>Title WinningStrategy</p>
 *
 * @author YiMing Liu
 * @date 2018/6/12 14:51
 * <p>Description:如果上一局获胜，下一局就会出跟上一局一样的手势</p>
 */
public class WinningStrategy implements Strategy {

    private Random random;
    private Hand h;
    private boolean won = false;

    public WinningStrategy(int seed) {
        random = new Random(seed);
    }

    @Override
    public Hand nextHand() {
        if (!won) {
            h = Hand.getHand(random.nextInt(3));
        }
        return h;
    }

    @Override
    public void study(boolean win) {
        won = win;
    }
}
